import type {
  AxiosInterceptorOptions,
  AxiosRequestConfig,
  AxiosRequestHeaders,
  AxiosResponse,
  InternalAxiosRequestConfig,
} from 'axios';

// 拦截器类型
interface KaInterceptors<T = AxiosResponse> extends AxiosInterceptorOptions {
  reqSuccess?: (config: InternalAxiosRequestConfig) => InternalAxiosRequestConfig;
  reqFail?: (err: any) => any;

  resSuccess?: (response: T) => T;
  resFail?: (err: any) => any;
}

export interface kaRequestConfig<T = AxiosResponse> extends AxiosRequestConfig {
  interceptor?: KaInterceptors<T>; //继承axios 在加上自己的拦截器
  isTokenRequire?: boolean;
  isUnLoginTokenRequire?: boolean;
  headers?: AxiosRequestHeaders;
}
